﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using System.Linq;

namespace QuangNgai.nhaplieu.timkiemthongke
{
    public partial class TimHSVB : DevExpress.XtraEditors.XtraForm
    {
        private LTQNLinQDataContext db;
        public TimHSVB()
        {
            db = new LTQNLinQDataContext();
            InitializeComponent();
        }

        private void TimHSVB_Load(object sender, EventArgs e)
        {
            LoadComboHoSo();
        }

        private void LoadComboHoSo()
        {
            var hoSos = (from h in db.HoSos select h);
            cbMaHS.Properties.DataSource =  hoSos;
            //var ids = (from h in db.HoSos select h.HSID).ToArray();
            //Array.ForEach(ids, delegate(int id) { cbHS.Items.Add(id + ""); });
            cbMaHS.Properties.ValueMember = "HSID";
            cbMaHS.Properties.DisplayMember = "HSID";
        }

        private void cbMaHS_EditValueChanged(object sender, EventArgs e)
        {
           // txtTieuDe.Enabled = cbMaHS.EditValue == null ? true : false;
        }

        private void txtTieuDe_EditValueChanged(object sender, EventArgs e)
        {
            cbMaHS.EditValue = null;
        }
    }
}